using System;
using System.ComponentModel;
using System.Transactions;

using SIS.ENT;
using SIS.DAL;


namespace SIS.BLL {

/// <summary>
/// The EnquiryTypeTableManager class is responsible for managing BO.EnquiryTypeTable objects in the system.
/// </summary>
[DataObjectAttribute()]
public class EnquiryTypeTableManager
  {

#region "Public Methods"

/// <summary>
/// Gets a list with all EnquiryTypeTable objects in the database.
/// </summary>
/// <returns>A list with all EnquiryTypeTable from the database when the database contains any, or null otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Select, true)]
public static EnquiryTypeTableList GetList(){
return EnquiryTypeTableDB.GetList();
}

/// <summary>
/// Gets a single EnquiryTypeTable from the database without its data.
/// </summary>
/// <param name="enquiryType">The EnquiryType of the EnquiryTypeTable in the database.</param>
/// <returns>A EnquiryTypeTable object when the EnquiryType exists in the database, or <see langword="null"/> otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static EnquiryTypeTable GetItem(short enquiryType){
return GetItem(enquiryType, false);
}

/// <summary>
/// Gets a single EnquiryTypeTable from the database.
/// </summary>
/// <param name="enquiryType">The EnquiryType of the EnquiryTypeTable in the database.</param>
/// <param name="getEnquiryTypeTableRecords">Determines whether to load all associated EnquiryTypeTable records as well.</param>
/// <returns>
/// A EnquiryTypeTable object when the EnquiryType exists in the database, or <see langword="null"/> otherwise.
/// </returns>
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static EnquiryTypeTable GetItem(short enquiryType, bool getEnquiryTypeTableRecords){
EnquiryTypeTable myEnquiryTypeTable = EnquiryTypeTableDB.GetItem(enquiryType);
return myEnquiryTypeTable;
}

/// <summary>
/// Saves a EnquiryTypeTable in the database.
/// </summary>
/// <param name="myEnquiryTypeTable">The EnquiryTypeTable instance to save.</param>
/// <returns>The new EnquiryType if the EnquiryTypeTable is new in the database or the existing EnquiryType when an item was updated.</returns>
[DataObjectMethod(DataObjectMethodType.Update, true)]
public static short Save(EnquiryTypeTable myEnquiryTypeTable){
using (TransactionScope myTransactionScope = new TransactionScope()){
short enquiryTypeTableEnquiryType = EnquiryTypeTableDB.Save(myEnquiryTypeTable);

//  Assign the EnquiryTypeTable its new (or existing EnquiryType).
myEnquiryTypeTable.EnquiryType = enquiryTypeTableEnquiryType;

myTransactionScope.Complete();

return enquiryTypeTableEnquiryType;
}
}

/// <summary>
/// Deletes a EnquiryTypeTable from the database.
/// </summary>
/// <param name="myEnquiryTypeTable">The EnquiryTypeTable instance to delete.</param>
/// <returns>Returns true when the object was deleted successfully, or false otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Delete, true)]
public static bool Delete(EnquiryTypeTable myEnquiryTypeTable){
return EnquiryTypeTableDB.Delete(myEnquiryTypeTable.EnquiryType);
}

#endregion

}

}
